/** ###################################################################
**     Filename  : Events.c
**     Project   : parking
**     Processor : MC9S12XS128MAL
**     Component : Events
**     Version   : Driver 01.04
**     Compiler  : CodeWarrior HCS12X C Compiler
**     Date/Time : 2013-2-23, 14:36
**     Abstract  :
**         This is user's event module.
**         Put your event handler code here.
**     Settings  :
**     Contents  :
**         No public methods
**
** ###################################################################*/
/* MODULE Events */


#include "Cpu.h"
#include "Events.h"

/* User includes (#include below this line is not maintained by Processor Expert) */
#include "Communication.h"
#include "Hmi.h"
#include "CommandSystem.h"
#include "Encoder.h"
#include "Drv.h"
#include "EM.h"
#include "ParkControl.h"
#include "Lights.h"
#pragma CODE_SEG DEFAULT

/*
** ===================================================================
**     Event       :  AS_OnRxChar (module Events)
**
**     Component   :  AS [AsynchroSerial]
**     Description :
**         This event is called after a correct character is received.
**         The event is available only when the <Interrupt
**         service/event> property is enabled and either the <Receiver>
**         property is enabled or the <SCI output mode> property (if
**         supported) is set to Single-wire mode.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void AS_OnRxChar(void)
{
	ASIrqHandler();
//	ASSendByte(ASReadEventStill());
	CSIrqHandler();

}

/*
** ===================================================================
**     Event       :  HMI_IRQ_OnInterrupt (module Events)
**
**     Component   :  HMI_IRQ [ExtInt]
**     Description :
**         This event is called when an active signal edge/level has
**         occurred.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void HMI_IRQ_OnInterrupt(void)
{
	HmiIrqHandler();
}


/*
** ===================================================================
**     Event       :  HMI_SPIN_OnInterrupt (module Events)
**
**     Component   :  HMI_SPIN [ExtInt]
**     Description :
**         This event is called when an active signal edge/level has
**         occurred.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void HMI_SPIN_OnInterrupt(void)
{
	HmiSpinIrqHandler();
}


/*
** ===================================================================
**     Event       :  HMI_PA_OnEdge (module Events)
**
**     Component   :  HMI_PA [PulseAccumulator]
**     Description :
**         This event is called when the selected edge is detected on
**         the input pin, only when the component is enabled -
**         <"Enable"> and the events are enabled - <"EnableEvent">. 
**         This event is only available if the edge interrupt is
**         supported by the timer.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void HMI_PA_OnEdge(void)
{
	EncoderDuplexIrqHandler();
}

/*
** ===================================================================
**     Event       :  DRV_TIMER_OnInterrupt (module Events)
**
**     Component   :  DRV_TIMER [TimerInt]
**     Description :
**         When a timer interrupt occurs this event is called (only
**         when the component is enabled - <Enable> and the events are
**         enabled - <EnableEvent>). This event is enabled only if a
**         <interrupt service/event> is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void DRV_TIMER_OnInterrupt(void)
{
	EncoderIrqHandler();
	DrvIrqHandler();
}

/*
** ===================================================================
**     Event       :  Sample_Timer_OnInterrupt (module Events)
**
**     Component   :  Sample_Timer [TimerInt]
**     Description :
**         When a timer interrupt occurs this event is called (only
**         when the component is enabled - <Enable> and the events are
**         enabled - <EnableEvent>). This event is enabled only if a
**         <interrupt service/event> is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void Sample_Timer_OnInterrupt(void)
{
}

/*
** ===================================================================
**     Event       :  AD_OnEnd (module Events)
**
**     Component   :  AD [ADC]
**     Description :
**         This event is called after the measurement (which consists
**         of <1 or more conversions>) is/are finished.
**         The event is available only when the <Interrupt
**         service/event> property is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void AD_OnEnd(void)
{
	EMIrqHandler();
}

/*
** ===================================================================
**     Event       :  PARK_TIMER_OnInterrupt (module Events)
**
**     Component   :  PARK_TIMER [TimerInt]
**     Description :
**         When a timer interrupt occurs this event is called (only
**         when the component is enabled - <Enable> and the events are
**         enabled - <EnableEvent>). This event is enabled only if a
**         <interrupt service/event> is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void PARK_TIMER_OnInterrupt(void)
{
	PCTimerIrqHandler();
}

/*
** ===================================================================
**     Event       :  DRV_SERVO_TIMER_OnInterrupt (module Events)
**
**     Component   :  DRV_SERVO_TIMER [TimerInt]
**     Description :
**         When a timer interrupt occurs this event is called (only
**         when the component is enabled - <Enable> and the events are
**         enabled - <EnableEvent>). This event is enabled only if a
**         <interrupt service/event> is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void DRV_SERVO_TIMER_OnInterrupt(void)
{
    DrvServoIrqHndler();
}

/*
** ===================================================================
**     Event       :  LT_TIMER_OnInterrupt (module Events)
**
**     Component   :  LT_TIMER [TimerInt]
**     Description :
**         When a timer interrupt occurs this event is called (only
**         when the component is enabled - <Enable> and the events are
**         enabled - <EnableEvent>). This event is enabled only if a
**         <interrupt service/event> is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void LT_TIMER_OnInterrupt(void)
{
	LTTimerHandler();
}

/* END Events */

/*
** ###################################################################
**
**     This file was created by Processor Expert 3.02 [04.44]
**     for the Freescale HCS12X series of microcontrollers.
**
** ###################################################################
*/
